---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mail-relay-env
data:
  POSTFIX_SMTP_HELO_NAME: "gitlab.kryukov.local"
  POSTFIX_MYORIGIN: "gitlab.kryukov.local"
  POSTFIX_MYHOSTNAME: "gitlab.kryukov.local"
  KUBER_NETWORK: "10.42.0.0/16"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mail-relay
data:
  main.cf.tmpl: |
    maillog_file = /dev/stdout
    smtp_helo_name = {{ .Env.POSTFIX_SMTP_HELO_NAME }}
    myorigin = {{ .Env.POSTFIX_MYORIGIN }}

    smtpd_banner = $myhostname ESMTP
    biff = no
    append_dot_mydomain = no
    readme_directory = no

    compatibility_level = 2

    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
    myhostname = {{ .Env.POSTFIX_MYHOSTNAME }}
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination = localhost.localdomain, localhost
    relayhost =
    mynetworks = 127.0.0.0/8 192.168.0.0/16 172.16.0.0/12 {{ .Env.KUBER_NETWORK }}
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = ipv4
